/*
 * launcher_robot14.cpp
 *
 *  Created on: Dec 19, 2013
 *      Author: m
 */

#include "ProcessAux.h"
#include "Cinta13A.h"
#include "Cinta13B.h"
#include "Cinta15.h"
#include "Robot11AProductor.h"
#include "Robot11BProductor.h"
#include "Robot14Consumidor.h"
#include "Robot14Productor.h"
#include "Robot16Consumidor.h"

int main ( int argc, char* argv[] )
{
    // Lanzar los semaforos distribuidos especificos del robot14
    {
        Argv args;
        args.pushArg( Cinta13A::s_ipcBaseFile );
        args.pushArg( Cinta13A::s_semProductorKey1 );
        args.pushArg( "cinta13aprod.dsem" );
        ProcessAux::launchProcess( "./dsSignaler", 1, args );
    }

    {
        Argv args;
        args.pushArg( Cinta13A::s_ipcBaseFile );
        args.pushArg( Cinta13A::s_semConsumidorKey2 );
        args.pushArg( "cinta13acons.dsem" );
        ProcessAux::launchProcess( "./dsWaiter", 1, args );
    }

    {
        Argv args;
        args.pushArg( Cinta13B::s_ipcBaseFile );
        args.pushArg( Cinta13B::s_semProductorKey1 );
        args.pushArg( "cinta13bprod.dsem" );
        ProcessAux::launchProcess( "./dsSignaler", 1, args );
    }

    {
        Argv args;
        args.pushArg( Cinta13B::s_ipcBaseFile );
        args.pushArg( Cinta13B::s_semConsumidorKey2 );
        args.pushArg( "cinta13bcons.dsem" );
        ProcessAux::launchProcess( "./dsWaiter", 1, args );
    }

    {
        Argv args;
        args.pushArg( Cinta15::s_ipcBaseFile );
        args.pushArg( Cinta15::s_semProductorKey2 );
        args.pushArg( "cinta15prod.dsem" );
        ProcessAux::launchProcess( "./dsWaiter", 1, args );
    }

    {
        Argv args;
        args.pushArg( Cinta15::s_ipcBaseFile );
        args.pushArg( Cinta15::s_semConsumidorKey1 );
        args.pushArg( "cinta15cons.dsem" );
        ProcessAux::launchProcess( "./dsSignaler", 1, args );
    }

    {
        Argv args;
        args.pushArg( Robot11AProductor::s_ipcBaseFile );
        args.pushArg( Robot11AProductor::s_semaphoreKey1 );
        args.pushArg( "r11aprod.dsem" );
        ProcessAux::launchProcess( "./dsSignaler", 1, args );
    }

    {
        Argv args;
        args.pushArg( Robot11BProductor::s_ipcBaseFile );
        args.pushArg( Robot11BProductor::s_semaphoreKey1 );
        args.pushArg( "r11bprod.dsem" );
        ProcessAux::launchProcess( "./dsSignaler", 1, args );
    }

    {
        Argv args;
        args.pushArg( Robot14Productor::s_ipcBaseFile );
        args.pushArg( Robot14Productor::s_semaphoreKey2 );
        args.pushArg( "r14prod.dsem" );
        ProcessAux::launchProcess( "./dsWaiter", 1, args );
    }

    {
        Argv args;
        args.pushArg( Robot16Consumidor::s_ipcBaseFile );
        args.pushArg( Robot16Consumidor::s_semaphoreKey1 );
        args.pushArg( "r16cons.dsem" );
        ProcessAux::launchProcess( "./dsSignaler", 1, args );
    }

    {
        Argv args;
        args.pushArg( Robot14Consumidor::s_ipcBaseFile );
        args.pushArg( Robot14Consumidor::s_semaphoreKey2 );
        args.pushArg( "r14cons.dsem" );
        ProcessAux::launchProcess( "./dsWaiter", 1, args );
    }

    ProcessAux::launchProcess( "./controlR14" );

    return 0;
}
